<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="file" class="file">
    <button>获取文件对象</button>
    <script src="lib/jquery.3.6.0.js"></script>
    <script>
$(function() {
    $('button').click(function(){
        const file=$('.file')[0].files[0];
        const formData=new FormData();
        formData.append("file_data",file)
        $.ajax({
            url:"http://127.0.0.1:3001/uploadFile",
            type:'post',
            data:formData,
            contentType:false,
            processData:false,
            success(res){
                console.log(res);
            }
        })
    })
})
    </script>
</body>
</html>